#include "Consuption.h"
#include <math.h>
#include "ErrorBase.h"

Consuption::Consuption(void){
	m_bIsInitiated = false;
}

Consuption::~Consuption(void){
	release();
}

int Consuption::init(void){
	release();
	m_iPopulationSize = 10;
	m_dPurchasingPowerIndex = 1;

	m_bIsInitiated = true;

	return RET_OK;
}

void Consuption::release(void){
	m_bIsInitiated = false;
}

double Consuption::calculateConsuption(double dProductPrice) const{
	if(m_bIsInitiated){
		return m_iPopulationSize / exp(dProductPrice);
	}
	else return NOT_INI;
}

double Consuption::calculateRealConsuption(double dProductPrice) const{
	if(m_bIsInitiated){
		return m_iPopulationSize / exp(dProductPrice - m_dPurchasingPowerIndex);
	}
	else return NOT_INI;
}

